<template>
  <el-container>
    <el-aside width="200px">
      <CompanyMenu></CompanyMenu>
    </el-aside>
    <el-row>
      <el-col :span="24"><div class="grid-content bg-purple-dark">面包屑</div></el-col>
    </el-row>
    <el-main>
      <el-table :data="companyUsers" style="width: 100%">
        <el-table-column label="日期" width="180">
          <template #default="scope">
            <span style="margin-left: 10px">{{ scope.row.name }}</span>
          </template>
        </el-table-column>
        <el-table-column label="姓名" width="180">
          <template #default="scope">
            <div v-for="(item, index) in companyUsers[scope.$index].companyUserList" :key="index">
              <span style="margin-left: 10px">{{ scope.row.companyUserList[index].userinfo }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="职位" width="180">
          <template #default="scope">
            <div v-for="(item, index) in companyUsers[scope.$index].companyUserList" :key="index">
              <span style="margin-left: 10px">{{ scope.row.companyUserList[index].position }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template #default="scope">
            <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-main>
  </el-container>
</template>

<script>
import CompanyMenu from "@/components/menu/CompanyMenu.vue";
import instanceToken from "@/utlis/tokenIdentify.js";
export default {
  name: 'EditPositionView',
  components: {
    CompanyMenu
  },
  data() {
    return {
      companyUsers: [],
      companyUserList:[]
    };
  },
  created() {
    this.initData();
  },
  methods: {
    initData(){
      instanceToken.get("/position/leader/initData").then(res =>{
        this.companyUsers = res.data.data;
        //console.log(this.companyUsers.length);
        for (let i=0;i<this.companyUsers.length;i++){
          //console.log(this.companyUsers[i].companyUserList);
          let length = this.companyUsers[i].companyUserList.length;
          console.log(this.companyUsers[i].companyUserList.length);
          for (let j=0;j<length;j++){
              this.companyUserList = this.companyUsers[i].companyUserList[j];
              console.log(this.companyUsers[i].companyUserList[j].userinfo)
          }
        }
      })
    },
    handleEdit(){

    }
  },

}
</script>